<?php $this->load->view('common/head');?>
		<form class="form-horizontal margin-top-10" name="add" id="add" action="<?php echo $this->input->server('REQUEST_URI'); ?>" method="post">
		  <input type="hidden" name="id" id="id" value="<?=$offlineData['id']?>">
		  <input type="hidden" name="procId" id="procId" value="<?=$procData['id']?>">
			<table class="table table-condensed table-bordered mb27" style="width: 350px; margin:0 auto;">
			  <tbody>
			    <tr>
			      <td class="bg-primary col-md-3" colspan="2">项目名称</td>
			      <td>
			      	<input required type="input" class="form-control" name="projectName" id="projectName" value="<?=$offlineData['projectName']?>" placeholder="项目名称">
			      </td>
			    </tr>
			    <tr>
			      <td class="bg-primary col-md-3" colspan="2">活动类型</td>
			      <td>
			        <select required class="form-control" placeholder="" id="mediaType" name="mediaType">
		        		<option value="">请选择</option>
			        </select>
			      </td>
			    </tr>
			    <tr>
			      <td class="bg-primary col-md-3" colspan="2">活动主题</td>
			      <td>
			      <input required type="input" class="form-control" name="theme" id="theme" value="<?=$offlineData['theme']?>" placeholder="活动主题">
			      </td>
			    </tr>
			    <tr>
			      <td class="bg-primary col-md-3" colspan="2">活动地点</td>
			      <td>
				    <input required type="input" class="form-control" name="address" id="address" value="<?=$offlineData['address']?>" placeholder="活动地点">
			      </td>
			    </tr>
			    <tr>
			      <td class="bg-primary col-md-3" colspan="2">开始时间</td>
			      <td>
			      <input type="input" required class="form-control" onFocus="WdatePicker({minDate:'<?=$this->timeUnitModel->getTimeUnitStartDate($procData['timeUnit'], $procData['year'])?>',maxDate:'#F{$dp.$D(\'endTime\')||\'<?=$this->timeUnitModel->getTimeUnitEndDate($procData['timeUnit'], $procData['year'])?>\'}'})" name="startTime" id="startTime" value="<?=$offlineData['startTime']?>" placeholder="开始时间">
			      </td>
			    </tr>
			    <tr>
			      <td class="bg-primary col-md-3" colspan="2">结束时间</td>
			      <td>
			      	<input type="input" required class="form-control" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'startTime\')||\'<?=$this->timeUnitModel->getTimeUnitStartDate($procData['timeUnit'], $procData['year'])?>\'}',maxDate:'<?=$this->timeUnitModel->getTimeUnitEndDate($procData['timeUnit'], $procData['year'])?>'})" name="endTime" id="endTime" value="<?=$offlineData['endTime']?>" placeholder="结束时间">
			      </td>
			    </tr>
			    <tr>
			      <td class="bg-primary col-md-3" rowspan="2">活动目标</td>	
			      <td class="bg-primary col-md-3">集客目标</td>
			      <td>
			      <input type="number" required min="0" class="form-control" name="targetCustomer" id="targetCustomer" value="<?=(float)$offlineData['targetCustomer']?$offlineData['targetCustomer']:''?>" placeholder="集客目标">
			      </td>
			    </tr>
			    <tr>
			      <td class="bg-primary col-md-3">订单目标</td>
			      <td>
			      <input type="number" required min="0" class="form-control" name="targetOrder" id="targetOrder" value="<?=(float)$offlineData['targetOrder']?$offlineData['targetOrder']:''?>" placeholder="订单目标">
			      </td>
			    </tr>
			    <tr>
			      <td class="bg-primary col-md-3" colspan="2">预算申请费用</td>
			      <td>
			      <input type="number" required min="0" step="0.01" class="form-control" name="budgetApply" id="budgetApply" value="<?=(float)$offlineData['budgetApply']?$offlineData['budgetApply']:''?>" placeholder="预算费用">
			      </td>
			    </tr>
			     <tr>
			      <td class="bg-primary col-md-3" colspan="2">营销活动方案上传</td>
			      <td>
			      <span id="budgetUploadDownload">
		            <?php if ($offlineData['budgetFileId']) {?>
		            <a type="button" class="btn btn-default" href="<?=printUrl('Upload','download',array('fileId'=>$offlineData['budgetFileId']))?>" aria-label="Left Align" role="button">
		              <span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span>
		              附件下载
		            </a>
		            <?php } ?>
		            </span>
		            <input type="hidden" id="budgetUploadFileId" name="budgetFileId" value="<?=$offlineData['budgetFileId']?>" readonly="readonly">
	              	<input type="button" id="budgetUpload" value="上传" /><br>
	              	(请上传压缩包格式)
			      </td>
			    </tr>
			    <tr>
			      <td class="bg-primary col-md-3" colspan="2">备注</td>
			      <td>
			   		<textarea class="form-control" name="remarks" id="remarks" rows="3"><?=$offlineData['remarks']?></textarea>
			      </td>
			    </tr>
			    <tr>
			      <td colspan="3" align="center">
			    	<button type="submit" class="btn btn-default btn-primary">保存</button>
			  		<button type="button" onclick="closeWindow()" class="btn btn-default btn-primary">取消</button>
			      </td>
			    </tr>
			    </tbody>
			  </table>
		</form>
<script type="text/javascript" src="public/js/commonOffline.js"></script>
<script type="text/javascript">
$(function(){
  initValidation();
  loadMediaType('mediaType',<?=(int)$offlineData['mediaType']?>);
});
//初始化验证
function initValidation(){
	$('form[name="add"]').find("input,select,textarea").jqBootstrapValidation("destroy");
	$('form[name="add"]').find("input,select,textarea").not("[type=submit]").jqBootstrapValidation({
	    preventSubmit:false,
	    submitSuccess: function (form, event) {
	         event.preventDefault();
	         ajaxFormSubmit('add');
	     },
	     submitError: function (form, event, errors) {
	       event.preventDefault();
	       }
  	});
}
</script>
<?php initUploadButtons(array('budgetUpload'), printUrl('Upload','uploadSave',array('dir'=>'settleFile')), 'imgFile'); ?>
<?php $this->load->view('common/foot');?>